package cn.schoolwow.quickdao.test.module.business.user.transaction.rollback.flow;

import cn.schoolwow.quickdao.domain.DAO;
import cn.schoolwow.quickdao.domain.database.parent.DatabaseType;
import cn.schoolwow.quickdao.test.entity.User;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import org.junit.Assert;

public class CheckRollbackCreateNumberColumnResultFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        DAO dao = flowContext.checkInstanceData(DAO.class);
        DatabaseType databaseType = flowContext.checkInstanceData(DatabaseType.class);

        switch (databaseType){
            case Postgresql:{
                Assert.assertFalse(dao.hasColumn(User.class, "number"));
            }break;
        }
    }

    @Override
    public String name() {
        return "检查回滚用户表新增工号字段结果";
    }
}
